package ltd.rycloud.tms.service;

import java.util.List;

import ltd.rycloud.tms.dao.TrainDao;
import ltd.rycloud.tms.entity.Traininfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class TrainService {
	@Autowired
	TrainDao trainDao;
	//添加 
	public Traininfo save(Traininfo train) {
		return trainDao.save(train);
	}
	//查看
	public List<Traininfo> findAll(){
		return trainDao.findAll();
	}
	//根据id查看
	public Traininfo getTrain(int id) {
		return trainDao.findById(id).get();
	}
	//修改
	public Traininfo update(Traininfo train) {
		return trainDao.save(train);
	}
	//删除
	public void delete(int id) {
		trainDao.deleteById(id);
	}
}
